<template>
  <div class="back-top" @click="goBackTop">
    <a href="javascript: void(0);" class="back-to-top"></a>
  </div>
</template>

<script>
export default {
  name: "BackTop",
  props: ["element"],
  methods: {
    goBackTop() {
      this.element.scrollTo({
        top: 0,
        behavior: "smooth",
      });
    },
  },
};
</script>

<style scoped>
.back-top {
  position: fixed;
  bottom: 120px;
  right: 9px;
  width: 38px;
  height: 38px;
  background-image: url();
  background-size: 38px 38px;
  background-repeat: no-repeat;
  background-position: 50%;
  z-index: 20;
}
</style>